#ifndef CRECIPEMODEL_H
#define CRECIPEMODEL_H

#include <QObject>
#include <QSqlTableModel>
#include "cconstdefinition.h"
#include "cmodel.h"


class CRecipeModel : public CModel
{
    Q_OBJECT
    Q_PROPERTY(int cuisineId READ cuisineId WRITE setCuisineId NOTIFY cuisineIdChanged)

public:
    explicit CRecipeModel(QObject *parent = 0);
    CRecipeModel(int cuisineId, QObject *parent = 0);
    int rowCount(const QModelIndex & parent = QModelIndex()) const;
    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;

signals:
    void cuisineIdChanged();

public slots:
    int cuisineId();
    void setCuisineId(int cuisineId);

protected:
    QString queryString();
    void initRoles();
    void refresh();

private:
    int m_cuisineId;
    const static QString KRecipeRoleNamesMap[][2];
    int m_roleStart;
    int m_roleEnd;
};

#endif // CRECIPEMODEL_H
